package com.demo.yuanzi.service.impl;


import com.demo.yuanzi.dao.YuanziSaUserRoleDao;
import com.demo.yuanzi.entity.YuanziSaUserRole;
import com.demo.yuanzi.service.YuanziSaUserRoleService;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;

/**
 * (YuanziSaUserRole)表服务实现类
 *
 * @author makejava
 * @since 2024-05-09 14:16:56
 */
@Service("yuanziSaUserRoleService")
public class YuanziSaUserRoleServiceImpl implements YuanziSaUserRoleService {
    @Resource
    private YuanziSaUserRoleDao yuanziSaUserRoleDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public YuanziSaUserRole queryById(Integer id) {
        return this.yuanziSaUserRoleDao.queryById(id);
    }

    /**
     * 新增数据
     *
     * @param yuanziSaUserRole 实例对象
     * @return 实例对象
     */
    @Override
    public YuanziSaUserRole insert(YuanziSaUserRole yuanziSaUserRole) {
        this.yuanziSaUserRoleDao.insert(yuanziSaUserRole);
        return yuanziSaUserRole;
    }

    /**
     * 修改数据
     *
     * @param yuanziSaUserRole 实例对象
     * @return 实例对象
     */
    @Override
    public YuanziSaUserRole update(YuanziSaUserRole yuanziSaUserRole) {
        this.yuanziSaUserRoleDao.update(yuanziSaUserRole);
        return this.queryById(yuanziSaUserRole.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.yuanziSaUserRoleDao.deleteById(id) > 0;
    }
}
